package com.tepth.vehiclemaintenance.base;

import android.os.Bundle;
import android.support.annotation.Nullable;

import butterknife.ButterKnife;
import butterknife.Unbinder;
import me.yokeyword.fragmentation.SupportActivity;

/**
 * Created by zhangyu on 2017/5/8.
 */

public abstract class BaseFragmentActivity extends SupportActivity {
    private Unbinder unbinder;

    public abstract int getLayoutId();

    public abstract void loadFragment();

    public abstract void initView();

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutId());
        unbinder = ButterKnife.bind(this);
        if (savedInstanceState == null) {
            loadFragment();
        }
        initView();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        unbinder.unbind();
    }

}
